package net.wanho.shiro.session;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.SessionContext;
import org.apache.shiro.session.mgt.SessionFactory;
import org.apache.shiro.web.session.mgt.WebSessionContext;

import javax.servlet.http.HttpServletRequest;

public class ShiroSessionFactory implements SessionFactory {

    public Session createSession(SessionContext initData) {

        WebSessionContext sessionContext = (WebSessionContext)initData;
        HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest();

        ShiroSession shiroSession = new ShiroSession();
        shiroSession.setHost("127.0.0.1");
        shiroSession.setBrowser("chrome 1.8");
        shiroSession.setOs("windows64");
        return shiroSession;
    }
}
